/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kylingroup.J2SE.Thread;

/**
 *
 * @author kylin
 */
public class TestThreadVariable2 implements Runnable{

    private int i;
    
    @Override
    public void run() {
        for(;i<100;i++){
            System.out.println(Thread.currentThread().getName()+" "+i);
        }
    }
    
    public static void main(String args[]){
        for(int i=0;i<100;i++){
            System.out.println(Thread.currentThread().getName()+" "+i);
            if(i==20){
                TestThreadVariable2 target=new TestThreadVariable2();
                new Thread(target,"new thread 1").start();
                new Thread(target,"new thread 2").start();
            }
        }
    }
}
